package com.usian.wemedia.controller;

import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmMaterialDto;
import com.usian.model.media.dtos.WmUserDto;
import com.usian.model.media.pojos.WmUser;
import com.usian.wemedia.LoginControllerApi;
import com.usian.wemedia.WmMaterialControllerApi;
import com.usian.wemedia.service.WmMaterialService;
import com.usian.wemedia.service.WmUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/v1/material")
@Api(value = "文件传输模块", tags = "文件上传下载")
public class WmMaterialController implements WmMaterialControllerApi {

    @Autowired
    private WmMaterialService wmMaterialService;


    @Override
    @ApiOperation(value = "素材上传")
    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile) {
        return wmMaterialService.uploadPicture(multipartFile);

    }

    @Override
    @PostMapping("/list")
    @ApiOperation(value = "素材展示")
    public ResponseResult findList(@RequestBody WmMaterialDto dto) {
        return wmMaterialService.findList(dto);
    }

    @Override
    @GetMapping("/del_picture/{id}")
    @ApiOperation(value = "素材删除")
    public ResponseResult delPicture(@PathVariable("id") Integer id) {
        return wmMaterialService.delPicture(id);
    }

    @Override
    @GetMapping("/collect/{id}")
    @ApiOperation(value = "素材删除")
    public ResponseResult updateStatus(@PathVariable("id") Integer id) {

        return wmMaterialService.updateStatus(id);
    }


}
